package script;

import org.openjdk.nashorn.api.scripting.NashornScriptEngineFactory;

import javax.script.ScriptEngine;
import javax.script.ScriptException;

public class ScriptEngineTest1 {
    public static void main(String[] args) throws ScriptException {
        NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
        ScriptEngine jsEngine = factory.getScriptEngine("--language=es6");
        jsEngine.eval("print('Hello World!')");
        jsEngine.eval("print(`Now date is ${new Date().toString()}`)");
    }
}
